<?php
function comment_sort()
{
	global $wpdb;
	$adminEmail = get_option('admin_email');	
    $query="SELECT COUNT(*) AS cnt, comment_author, comment_author_url, comment_author_email FROM $wpdb->comments WHERE comment_author_email != '$adminEmail' AND comment_approved='1' GROUP BY comment_author_email ORDER BY cnt DESC LIMIT 15";//大家把管理员的邮箱改成你的,最后的这个15是选取多少个头像，大家可以按照自己的主题进行修改,来适合主题宽度
    $wall = $wpdb->get_results($query);
	
    $maxNum = $wall[0]->cnt;
    foreach ($wall as $comment)
    {
        $width = round(36 / ($maxNum / $comment->cnt),2);//此处是对应的血条的宽度
        if( $comment->comment_author_url )
        $url = $comment->comment_author_url;
        else $url="#";
        $tmp = '<li><a target="_blank" href="'.$comment->comment_author_url.'"><span class="pic" style="background: url(http://www.gravatar.com/avatar/'.md5(strtolower($comment->comment_author_email)).'?s=36&d=monsterid&r=G) no-repeat;">pic</span><span class="num">'.$comment->cnt.'</span><span class="name">'.$comment->comment_author.'</span></a><div class="active-bg"><div class="active-degree" style="width:'.$width.'px"></div></div></li>';
        $output .= $tmp;
     }
    $output = '<div class="readerwall">'.$output.'<div class="clear"></div></div>';
    echo $output ;
}
?>